export enum CompareMode {
  /** 默认(相等比较) */
  Normal = "eq",
  /** 等于 */
  Equal = "eq",
  /** 不等于 */
  NotEqual = "ne",
  /** 小于 */
  Less = "lt",
  /** 小于或等于 */
  LessOrEqual = "le",
  /** 大于 */
  Greater = "gt",
  /** 大于或等于 */
  GreaterOrEqual = "ge",
  /** 开始于 */
  StartWith = "bw",
  /** 不开始于 */
  NotStartWith = "bn",
  /** 在数组内 */
  InArray = "in",
  /** 不在数组内 */
  NotInArray = "ni",
  /** 结束于 */
  EndWith = "ew",
  /** 不结束于 */
  NotEndWidth = "en",
  /** 包含 */
  Contain = "cn",
  /** 不包含 */
  NotContain = "nc",
  /** 为空数据 */
  IsNULL = "nu",
  /** 不为空的数据 */
  IsNotNull = "nn",
}

export class SearchFilterItem {
  /** 字段名称 */
  Field: string;
  /** 比较符 */
  Op: CompareMode = CompareMode.Normal;
  /** 比较的值 */
  Data?: any;
}

export class SearchFilter {
  GroupOp: "AND" | "OR" = "AND";
  Rules = new Array<SearchFilterItem>();
  Groups = new Array<SearchFilter>();
}

/** 搜索查询的实体 */
export class SearchDto {
  Search = true;
  Page = 1;
  Size = 50;
  Sord?: string;
  Filters = new SearchFilter();
}
